<?php defined('SYSPATH') or die('No direct script access.');

class Controller_test extends Controller {

    public function action_index() {
        echo "test";
    }

    public function action_upload() {
        $url = "http://root:2124416@10.128.36.21/cgi-bin/video.jpg";
        //original image
        $img = $url;

        //directory to copy to (must be CHMOD to 777)
        $copydir = realpath("assets/videos");

        echo $copydir;

//        $i=10;
//        for($i=10;$i<20;$i++){
//            $data = file_get_contents($img);
//            $file = fopen($copydir . "/blah".$i.".jpg", "w+");
//            fputs($file, $data);
//            fclose($file);
//            echo $i;
//        }

        echo "<SCRIPT language=JavaScript>";

      echo "if ((navigator.appName == \"Microsoft Internet Explorer\")&&(navigator.platform != \"MacPPC\"))";
      echo "{";
      echo  "document.write(\"<OBJECT ID=\"VAtCtrl\" WIDTH=714 HEIGHT=646 name=\"VAtCtrl\"\");";
      echo  "document.write(\" CLASSID=CLSID:210D0CBC-8B17-48D1-B294-1A338DD2EB3A\");";
      echo  "document.write(\" CODEBASE=\"/VatDec.cab#version=1,0,0,68\">\");";
      echo  "document.write(\"<PARAM NAME=\"VSize\" VALUE=\"SIF\">\");";
      echo  "document.write(\"<PARAM NAME=\"Language\" VALUE=\"en\">\");";
      echo  "document.write(\"<PARAM NAME=\"Deblocking\" VALUE=\"true\">\");";
      echo  "document.write(\"<PARAM NAME=\"DisplayTimeFormat\" VALUE=\"1\">\");";
      echo  "document.write(\"<PARAM NAME=\"DigitalZoomEnableChk\" VALUE=\"true\">\");";
      echo  "document.write(\"<PARAM NAME=\"DigitalZoomEdit\" VALUE=\"true\">\");";
      echo  "document.write(\"<PARAM NAME=\"Url\" VALUE=\"http://10.128.36.21/cgi-bin/control.cgi\">\");";
      echo  "document.write(\"</OBJECT>\");";
      echo "}</SCRIPT>";

    }
}

?>
